#!/usr/bin/python

import MySQLdb as mdb;
import sys;

con = mdb.connect('localhost', 'testuser', 'test123', 'address');

with con:
	cur = con.cursor()
	cur.execute("SELECT * FROM address")

	numrows = int(cur.rowcount)

	for i in range(numrows):
		row = cur.fetchone()
		#print row[0], row[1], row[2], row[3], row[4], row[5], row[6]
		name_first = row[0]
		name_last = row[1]
		address_01 = row[2]
		address_02 = row[3]
		address_city = row[4]
		address_state = row[5]
		address_postal_code = row[6]
		print "<tr><td>$name_first</td><td>$name_last</td><td>$address_01</td><td>$address_02</td><td>$address_city</td><td>$address_state</td><td>$address_postal_code</td></tr>\n"


con.close()

